<template>
<UserForm :register="true" @onSubmit="onSubmit"></UserForm>
</template>

<script>
import { register } from '@/api/user'
import UserForm from '@/components/UserForm.vue'

export default {
  name: 'LoginPage',
  components: {
    UserForm
  },
  data () {
    return {
      username: 'zhousg',
      password: '123456'
    }
  },
  methods: {
    async onSubmit (values) {
      await register(values)
      this.$toast('注册成功')
      this.$router.push({ path: '/login' })
    }
  }
}
</script>
